#include "nmkb.h"
#define NPrint(x) __DPrint x

typedef struct {
    HANDLE file;
} input_t;
typedef struct {
    PFILE_OBJECT file;
}out_t;
void net_con(PVOID input,ULONG isize,PVOID output, ULONG osize,PIRP Irp)
{
    input_t* in= (input_t*)input;
    out_t* out = (out_t*)output;
    PFILE_OBJECT file;
    NTSTATUS stat = 0;
    __try{
        NPrint(("Entry net_con"));
        NPrint(("%x %x %x %x",input,isize,output,osize));
        stat = ObReferenceObjectByHandle(in->file,GENERIC_ALL,0,KernelMode,&file,0);

        if (STATUS_SUCCESS == stat) {
            NPrint(("File: %x",file));
            out->file = file;
        }
        else {
            out->file = (PFILE_OBJECT)stat;
        }
        Irp->IoStatus.Information = sizeof(out_t);
    }
    __except(EXCEPTION_EXECUTE_HANDLER){
        NPrint(("Exception occurrd"));
    }
}